<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('古诗词列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>标题：</p>
                                <input type="text" name="mingcheng"/>
                            </li>
                            <li>
                                <p>作者：</p>
                                <input type="text" name="zuozhe"/>
                            </li>
                            <li>
                                <p>朝代：</p>
                                <input type="text" name="chaodai"/>
                            </li>
                            <li>
                                <p>分类：</p>
                                <input type="text" name="fenlei"/>
                            </li>
                            <li>
                                <p>诗集：</p>
                                <input type="text" name="congshu"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="poem:poem:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="poem:poem:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('poem:poem:edit')}]];
        var removeFlag = [[${@permission.hasPermi('poem:poem:remove')}]];
        var voiceDatas = [[${@dict.getType('common_support')}]];
        var prefix = ctx + "poem/poem";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "古诗词",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id',
                },
                {
                    field : 'mingcheng', 
                    title : '题目'
                },
                {
                    field : 'zuozhe', 
                    title : '作者'
                },
                {
                    field : 'yuanwen', 
                    title : '正文',
                    formatter: function(value, row, index) {
                		return $.table.tooltip(value);
                	}
                },
                {
                    field : 'zhujie', 
                    title : '注解',
                    formatter: function(value, row, index) {
                		return $.table.tooltip(value);
                	}
                },
                {
                    field : 'yiwen', 
                    title : '译文',
                    formatter: function(value, row, index) {
                		return $.table.tooltip(value);
                	}
                },
                {
                    field : 'shangxi', 
                    title : '赏析',
                    formatter: function(value, row, index) {
                		return $.table.tooltip(value);
                	}
                },
                {
                    field : 'beijing', 
                    title : '背景',
                    formatter: function(value, row, index) {
                		return $.table.tooltip(value);
                	}
                },
                {
                    field : 'shipin', 
                    title : '诗频',
                    visible: false
                },
                {
                    field : 'ticai', 
                    title : '题材',
                    visible: false
                },
                {
                    field : 'chaodai', 
                    title : '朝代',
                    visible: false
                    
                },
                {
                    field : 'guojia', 
                    title : '国家',
                    visible: false
                },
                {
                    field : 'fenlei', 
                    title : '分类',
                    visible: false
                },
                {
                    field : 'jieduan', 
                    title : '阶段',
                    visible: false
                },
                {
                    field : 'keben', 
                    title : '课本',
                    visible: false
                },
                {
                    field : 'chuchu', 
                    title : '出处',
                    visible: false
                },
                {
                    field : 'congshu', 
                    title : '丛书',
                    visible: false
                },
                {
                    field : 'zhaiyao', 
                    title : '摘要',
                    visible: false
                },
                {
                    field : 'voice', 
                    title : '音频',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(voiceDatas, value);
                    }
                },
                {
                    field : 'url', 
                    title : '地址',
                    visible: false
                },
                {
                    field : 'viewCount', 
                    title : '浏览次数',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        //actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        //actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>